package pacificlms;

import java.sql.*;
import java.util.Calendar;
import pacificlms.Email.EmailManager;
import pacificlms.Verifiable.Database.*;

/**
 * This class is for running quick tests and debugging code before the GUI comes up
 * Comment out NOT DELETE any tests before checking in code
 * @author brian
 */
public class StartupTestArea {
    public static void RunTest()
    {
        MemberCreationTest();
        DatabaseLinkageTest();
        
        //EmailManager.CreateEmail("bahume@shaw.ca", "Hi Brian", "How is it going.");
        
        /*Calendar Now = Calendar.getInstance();
        String Str = Now.getTime().toString();
        Str = Str + "";*/
        
        /*String Str = String.format("%.2f", 0.5);
        Str = String.format("%.2f", 0.52);
        Str = String.format("%.2f", 0.523);
        Str = String.format("%.2f", 0.003);
        Str = String.format("%.2f", 0.009);
        Str = String.format("%.2f", 100.5);
        Str = String.format("%.2f", 100.52);
        Str = String.format("%.2f", 100.523);
        Str = String.format("%.2f", 100.003);
        Str = String.format("%.2f", 100.009);*/
    }
    
    private static void MemberCreationTest()
    {
        /*Member TM = new Member();
        TM.IdentityNumber="12345678";
        TM.Password="1";
        TM.Email="a@b.c";
        TM.Name="jim";
        TM.PhoneNumber="123-456-7890";
        TM.Type="student";
        TM.JoinDate="201a-01-01";//YEAR-MONTH-DAY
        TM.LibraryCardNumber="111222333444";
        TM.CardExpiry="2011-01-01";
        
        boolean Ver = TM.Verify();
        
        String Str = TM.InsertRecrodSQL("Member");
        String Str2 = TM.UpdateRecrodSQL("Member");*/
    }
    
    private static void DatabaseLinkageTest()
    {
        /*try
        {
            Statement stmt = MasterConnection.getInstance().createStatement();

            ResultSet RS = stmt.executeQuery("SELECT * FROM CheckOut");
            RS.next();
            CheckOut Ob1 = new CheckOut();
            Ob1.FillFromResultSet(RS, RS.getMetaData());
            boolean Ver = Ob1.Verify();

            RS = stmt.executeQuery("SELECT * FROM Copy");
            RS.next();
            Copy Ob2 = new Copy();
            Ob2.FillFromResultSet(RS, RS.getMetaData());
            Ver = Ob2.Verify();

            RS = stmt.executeQuery("SELECT * FROM CourseReserve");
            RS.next();
            CourseReserve Ob3 = new CourseReserve();
            Ob3.FillFromResultSet(RS, RS.getMetaData());
            Ver = Ob3.Verify();

            RS = stmt.executeQuery("SELECT * FROM Hold");
            RS.next();
            Hold Ob4 = new Hold();
            Ob4.FillFromResultSet(RS, RS.getMetaData());
            Ver = Ob4.Verify();

            RS = stmt.executeQuery("SELECT * FROM InterLibraryLoan");
            RS.next();
            InterLibraryLoan Ob5 = new InterLibraryLoan();
            Ob5.FillFromResultSet(RS, RS.getMetaData());
            Ver = Ob5.Verify();//source library

            RS = stmt.executeQuery("SELECT * FROM Member");
            RS.next();
            Member Ob6 = new Member();
            Ob6.FillFromResultSet(RS, RS.getMetaData());
            Ver = Ob6.Verify();//library card # must be 12 char

            RS = stmt.executeQuery("SELECT * FROM Resource");
            RS.next();
            Resource Ob7 = new Resource();
            Ob7.FillFromResultSet(RS, RS.getMetaData());
            Ver = Ob7.Verify();
            */
            /*Statement stmt = con.createStatement();

            ResultSet RS = stmt.executeQuery("SELECT * FROM member");

            while (RS.next())
            {
                Member TM2 = new Member();
                TM2.FillFromResultSet(RS, RS.getMetaData());
                Ver = TM.Verify();
            }
        }
        catch(Exception ex)
        {
            
        }*/
    }
}
